package com.pqc.tbk.web.admin;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pqc.tbk.service.admin.AdviceService;

@Controller
public class AdviceController {

	@RequestMapping(value = "/advice", method = RequestMethod.POST)
	@ResponseBody
	public String advice(final String name, final String content,
			final HttpServletRequest request) {

		final String ip = request.getRemoteAddr();
		adviceService.save(name, content, ip);
		return "";
	}

	@Autowired
	private AdviceService adviceService;

}
